package org.csu.gp_store.common;

import lombok.Data;
import lombok.Getter;

@Getter
public enum ProductStatusCode {
    ON_SALE(0, "售卖中"),
    SOLD_OUT(1, "已售完"),
    NOT_ON_SALE(3,"已下架");


    private final int code;

    private final String description;

    ProductStatusCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static String getDescriptionByCode(int code){
        switch (code){
            case 0:return ON_SALE.getDescription();
            case 1:return SOLD_OUT.getDescription();
            case 3:return NOT_ON_SALE.getDescription();
            default:return "未知状态";
        }
    }
}
